package org.xhs.geomap.net
{
	import com.mapabc.maps.api.basetypes.MLngLat;
	
	import flash.utils.Dictionary;
	
	public class CityData
	{
		private var cityCodeMap:Dictionary = new Dictionary();
		
		public function CityData()
		{
			cityCodeMap["110000"] = {id:"0101", name:"北京市", lng:"116.39739990234375", lat:"39.90769525847961"};
			cityCodeMap["120000"] = {id:"0102", name:"天津市", lng:"117.20935821533203", lat:"39.13538645577105"};
			cityCodeMap["130100"] = {id:"010301", name:"石家庄市", lng:"114.51169967651367", lat:"38.03916849485911"};
			cityCodeMap["130200"] = {id:"010302", name:"唐山市", lng:"118.17770004272461", lat:"39.645089398186414"};
			cityCodeMap["140100"] = {id:"010401", name:"太原市", lng:"112.5436019897461", lat:"37.88284754987507"};
			cityCodeMap["150100"] = {id:"010501", name:"呼和浩特市", lng:"111.65559768676758", lat:"40.81881095338076"};
			cityCodeMap["210100"] = {id:"020601", name:"沈阳市", lng:"123.4339714050293", lat:"41.804909887273936"};			
			cityCodeMap["210200"] = {id:"020610", name:"大连市", lng:"121.61006927490234", lat:"38.91374309174291"};
			cityCodeMap["220100"] = {id:"020701", name:"长春市", lng:"125.32482147216797", lat:"43.878097874251736"};
			cityCodeMap["220200"] = {id:"020704", name:"吉林市", lng:"126.56696319580078", lat:"43.8586681102069"};
			cityCodeMap["230100"] = {id:"020801", name:"哈尔滨市", lng:"126.64575576782227", lat:"45.760158093332024"};
			cityCodeMap["310000"] = {id:"0309", name:"上海市", lng:"121.46347045898438", lat:"31.219848226201204"};
			cityCodeMap["320100"] = {id:"031001", name:"南京市", lng:"118.78405094146729", lat:"32.05875469864677"};
			cityCodeMap["320500"] = {id:"031013", name:"苏州市", lng:"120.62232971191406", lat:"31.306476820693735"};
			cityCodeMap["330100"] = {id:"031101", name:"杭州市"};
			cityCodeMap["330200"] = {id:"031105", name:"宁波市"};
			cityCodeMap["330300"] = {id:"031110", name:"温州市"};
			cityCodeMap["340100"] = {id:"031201", name:"合肥市"};
			cityCodeMap["350100"] = {id:"031301", name:"福州市"};
			cityCodeMap["350200"] = {id:"031306", name:"厦门市"};
			cityCodeMap["360100"] = {id:"041401", name:"南昌市"};
			cityCodeMap["370100"] = {id:"031401", name:"济南市", lng:"117.02499389648438", lat:"36.675234293741696"};
			cityCodeMap["370200"] = {id:"031409", name:"青岛市"};
			cityCodeMap["410100"] = {id:"041601", name:"郑州市"};
			cityCodeMap["420100"] = {id:"041701", name:"武汉市"};
			cityCodeMap["430100"] = {id:"041801", name:"长沙市"};
			cityCodeMap["440100"] = {id:"041901", name:"广州市"};
			cityCodeMap["440300"] = {id:"041912", name:"深圳市"};
			cityCodeMap["441900"] = {id:"041911", name:"东莞市"};
			cityCodeMap["450100"] = {id:"042001", name:"南宁市"};
			cityCodeMap["460100"] = {id:"052101", name:"海口市"};
			cityCodeMap["500000"] = {id:"0522", name:"重庆市"};
			cityCodeMap["510100"] = {id:"052301", name:"成都市", lng:"104.06593322753906", lat:"30.657516991581076"};
			cityCodeMap["520100"] = {id:"053401", name:"贵阳市"};
			cityCodeMap["530100"] = {id:"052401", name:"昆明市"};
			cityCodeMap["540100"] = {id:"052501", name:"拉萨市"};
			cityCodeMap["610100"] = {id:"062601", name:"西安市"};
			cityCodeMap["620100"] = {id:"062701", name:"兰州市", lng:"103.81758213043213", lat:"36.0596116339527"};
			cityCodeMap["630100"] = {id:"062801", name:"西宁市"};
			cityCodeMap["640100"] = {id:"062901", name:"银川市"};
			cityCodeMap["650100"] = {id:"063001", name:"乌鲁木齐市"};
		}
		
		public function getCityCode(cid:String):String
		{
			if(cityCodeMap[cid] == undefined)
				return "0101";
			else
				return cityCodeMap[cid].id;
		}
		
		public function getCentLnglat(cid:String):MLngLat
		{
			var centLnglat:MLngLat;
			for each(var item:Object in cityCodeMap)
			{
				if(item.id == cid)
				{
					centLnglat = new MLngLat(item.lng, item.lat);
					break;
				}
			}
			return centLnglat;
		}
	}
}